<template>
  <div v-show="loading" class="yingyangContainer">
    <div class="loginImg active">
      <div class="ying"></div>
      <div class="yang"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Loading",
  props: ["loading"],
};
</script>

<style lang="less" scoped>
.yingyangContainer {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 3;
  display: flex;
  justify-content: center;
  background-color: white;
}
.loginImg {
  width: 50px;
  height: 50px;
  font-size: 0px;
  border-radius: 50%;
  margin-top: 50px;
  overflow: hidden;
  border: 1px solid black;
  position: relative;
  &::before {
    content: "";
    float: left;
    width: 50%;
    height: 100%;
    background-color: white;
  }
  &::after {
    content: "";
    float: left;
    width: 50%;
    height: 100%;
    background-color: black;
  }
  .ying {
    width: 50%;
    height: 50%;
    position: absolute;
    left: 25%;
    border-radius: 50%;
    top: 0px;
    background-color: white;
    &::before {
      content: "";
      width: 40%;
      height: 40%;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      border-radius: 50%;
      background-color: black;
    }
  }
  .yang {
    width: 50%;
    height: 50%;
    position: absolute;
    left: 25%;
    border-radius: 50%;
    bottom: 0px;
    background-color: black;
    &::before {
      content: "";
      width: 40%;
      height: 40%;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      border-radius: 50%;
      background-color: white;
    }
  }
  &.active {
    animation: yingyang 1s linear 0s infinite;
  }
  @keyframes yingyang {
    from {
      transform: rotateZ(0deg);
    }
    to {
      transform: rotateZ(360deg);
    }
  }
}
</style>
